
/***************************************************************************************************
 *
 * Project: Utilities
 *
 * Class: DBUtils
 *
 * File name: DBUtils.java
 *
 * May 5, 2008
 *
 **************************************************************************************************/

package com.eastmountain.util.db;

import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.SQLException;

public class DBUtils {
    

    private DBUtils() {
        
    }
    
    /*************************************************
     *
     *   displayDBInfo
     *
     ************************************************/

    public static void displayDBInfo( Connection dbConnection ) {
        
        DatabaseMetaData databaseMetaData;
        
        try {
            
            databaseMetaData = dbConnection.getMetaData();

            System.out.println( "\n*****************************"
                                + "\n********   DB Info   ********"
                                + "\n*****************************\n"
                                
            + "URL:                      " + databaseMetaData.getURL() + "\n"
            + "User Name:                " + databaseMetaData.getUserName() + "\n"
            + "\n"
            + "Database Product Name:    " + databaseMetaData.getDatabaseProductName() + "\n"
            + "Database Product Version: " + databaseMetaData.getDatabaseProductVersion() + "\n"
            + "\n"
            + "Driver Name:              " + databaseMetaData.getDriverName() + "\n"
            + "Driver Version:           " + databaseMetaData.getDriverVersion() + "\n"
            + "\n"
            + "JDBC Major Version:       " + databaseMetaData.getJDBCMajorVersion() + "\n"
            + "JDBC Minor Version:       " + databaseMetaData.getJDBCMinorVersion() + "\n"
            + "\n"
            + "Database Major Version:   " + databaseMetaData.getDatabaseMajorVersion() + "\n"
            + "Database Minor Version:   " + databaseMetaData.getDatabaseMinorVersion() + "\n"
            

            + "\n*****************************"
            + "\n*****************************\n" );

            
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        
    }


}
